package com.etone.smartAudit.config;

import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.digest.DigestUtil;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
@Data
public class EGCCConfig {

    /***
     * 公共参数
     * sid	1	String	v50	请求流水号	需要保证在本系统中唯一
     * appId	1	String	v30	应用编号
     * time	1	String	14	请求时间	格式为：yyymmddhh24miss
     * token	1	String	v40	凭证	1.	平台调用应用时为appSecret的值；
     * 2.	应用调用平台时为accessToken的值；
     * 3.	调用获取访问令牌接口时传固定值“accessToken”
     */
    @Value("${egc.app_id:NSgJYJsC}")
    private String appId;

    private String sid = "5e3f28be4f004b90a1add6c3f85ede4c";//="332d9045206b499e85fc719f126b99df";
    /***
     * 請求时间
     */
    private Long time;
    private String token;
    @Value("${egc.app_secret:PXwJrLa3}")
    private String appSecret;
//    private String accessToken;
    /***
     * 开发者id
     */
    @Value("${egc.corp_id:7732ceb813ae4d09a602902f7f8700cd}")
    private String corpId;

    /***
     * 签名公钥
     */
    @Value("${egc.public_key:MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7OLxKa6taQxK1PCFIn1N/UFwx1rCGKQ0oN1T2H9UnBWVNYVhUJHqMBZwfBs6kNZwSn3uDkLnNgA94NAzwCjzjj6cBta7NWLZTVZTBfP2bw2ujPmVClMwK/sj5KlTRRlUoHZ6tdvcK85iovaA6E3fYmO/fJyIQ13KbgEFyd2HUGQIDAQAB}")
    private String publicKey;
//                             "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7OLxKa6taQxK1PCFIn1N/UFwx1rCGKQ0oN1T2H9UnBWVNYVhUJHqMBZwfBs6kNZwSn3uDkLnNgA94NAzwCjzjj6cBta7NWLZTVZTBfP2bw2ujPmVClMwK/sj5KlTRRlUoHZ6tdvcK85iovaA6E3fYmO/fJyIQ13KbgEFyd2HUGQIDAQAB"

    /**
     * 我方提供
     */

    private String authKey = "bbcf8e6a11cb42e4ba42dea638877395";

    public EGCCConfig init() {
        this.time = System.currentTimeMillis();
        this.token = "accessToken";
        return this;
    }


    public static void main(String[] args) {
        System.out.println(IdUtil.fastSimpleUUID());
        System.out.println(DigestUtil.md5Hex(IdUtil.fastSimpleUUID()));
    }
}
